package com.atguigu.spring.annotation;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.atguigu.spring.annotation.controller.UserController;
import com.atguigu.spring.annotation.repository.UserRepository;
import com.atguigu.spring.annotation.service.UserService;

public class Main {
	
	public static void main(String[] args) {
		
		ApplicationContext ctx = new ClassPathXmlApplicationContext("beans-annotation.xml");
		
		//UserAction userAction = ctx.getBean(UserAction.class);
		//userAction.execute();
		Object to = ctx.getBean("testObject");
		System.out.println(to);
		UserController userController = (UserController) ctx.getBean("userController");
		System.out.println(userController);
		userController.execute();
		UserService userService = (UserService) ctx.getBean("userService");
		System.out.println(userService);
		UserRepository userRepositoryImpl = (UserRepository) ctx.getBean("userRepository");
		System.out.println(userRepositoryImpl);
		
	}
	
}
